package com.buba.service.impl;

import com.buba.mapper.PeopleManagementMapper;
import entity.sparemanage.vo.wareVo;
import entity.system.PeopleManagement;
import entity.system.WarehouseManagement;
import com.buba.mapper.WarehouseManagementMapper;
import com.buba.service.WarehouseManagementService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * <p>
 * 仓库管理信息表 服务实现类
 * </p>
 *
 * @author beisheng
 * @since 2023-05-18
 */
@Service
public class WarehouseManagementServiceImpl extends ServiceImpl<WarehouseManagementMapper, WarehouseManagement> implements WarehouseManagementService {

    @Autowired
    private WarehouseManagementMapper warehouseManagementMapper;
    @Autowired
    private PeopleManagementMapper peopleManagementMapper;

    /* *
     * @Author: beisheng
     * @Descriprion: 根据仓库ID查询仓库信息及仓库负责人
     * @Date: 2023/5/25 10:11
     * @Return: entity.sparemanage.vo.wareVo
     * @Param: [id]
     */

    @Override
    public wareVo selOneWareHouse(Integer id) {
        wareVo wareVo = new wareVo();
        WarehouseManagement warehouseManagement = warehouseManagementMapper.selectById(id);
        BeanUtils.copyProperties(warehouseManagement,wareVo);
        PeopleManagement peopleManagement = peopleManagementMapper.selectById(warehouseManagement.getPrincipal());
        wareVo.setPeopleName(peopleManagement.getPeopleManagementName());
        return wareVo;
    }
}
